package cn.marinda.spritefragment.listener;

import cn.marinda.spritefragment.util.PlayerUtil;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;

public class PlayerListener implements Listener {
    //登录事件
    @EventHandler
    public void onJoin(PlayerJoinEvent e){
        if(!PlayerUtil.playerOnlineList.contains(e.getPlayer())){
            PlayerUtil.playerOnlineList.add(e.getPlayer());
        }
    }
    //退出事件
    @EventHandler
    public void onQuit(PlayerQuitEvent e){
        if(PlayerUtil.playerOnlineList.contains(e.getPlayer())){
            PlayerUtil.playerOnlineList.remove(e.getPlayer());
        }
    }
}
